<style type="text/css" media="all">@import "member.css";</style>
<?php
	if($_POST["op"] == "updata") {
		include("do_edit_account.inc.php");
		exit;
	}
	session_start();
	include("../../dbconnect.inc.php");
		$id = $_GET["id"];
		//$id = $_SESSION["userid"];

	$sql = "select * from users where id={$id}";
	$res = mysql_query($sql);
	$row = mysql_fetch_array($res);
	extract($row);
?>
 <table width="100%" id="content" border="0" cellpadding="0" cellspacing="6" class="border">
  <tr>
   <td  id="main">
   <h2><?php echo $_SESSION["username"]; ?></h2><ul class="tabs primary">
<li class="active"><a href="account.php" >lookup</a></li>
<li class="active"><a href="edit_account.php" class="active" >edit</a></li>
</ul>
<script>
	function check_form() {
		password = document.getElementById("edit-pass").value;
		password2 = document.getElementById("edit-pass2").value;
		mail = document.getElementById("edit-mail").value;
		emsg = "";
		if(password != password2) emsg += "the twice password was not same. \n";
		var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
		if(!pattern.test(mail)) emsg += "E-mail wrong. \n";
		if(emsg != "" ) {
			emsg = "------------------------------------------\n\n"+emsg;
			emsg = emsg+"\n------------------------------------------";
			alert(emsg);
			return false;
		}else {
			return true;
		}
	}
</script>
<!-- begin content -->
<form action="edit_account.php"  method="post" id="user_edit">

<div><div class="form-item">
 <label for="edit-name">username: </label>
<span><?php echo $username; ?></span>
</div>
<div class="form-item">
 <label for="edit-pass">password(if you not change password please put it blank): </label>
 <div><input type="password" maxlength="64" name="edit[pass]" id="edit-pass"  size="30" value="" class="form-text required" />
 please input password.</div>
 <div><input type="password" maxlength="64" name="edit[pass2]" id="edit-pass2"  size="30" value="" class="form-text required" />
please input password again.</div>
</div>
<div class="form-item">
 <label for="edit-mail">E-mailAddress: </label>
 <input type="text" maxlength="64" name="edit[mail]" id="edit-mail"  size="30" value="<?php echo $mail; ?>" class="form-text required" />
 <div class="description">Your E-mail address must be right!</div>
</div>
<div class="form-item">
<label for="edit-sex">sex: </label>
secret <input type="radio" name="edit[sex]"  value="0"  <?php if($sex==0) echo "checked=checked"; ?> />
male <input type="radio" name="edit[sex]"   value="1"  <?php if($sex==1) echo "checked=checked"; ?> />
female <input type="radio" name="edit[sex]"  value="2"  <?php if($sex==2) echo "checked=checked"; ?> />
</div>
<div class="form-item">
 <label for="edit-tel">phonecall:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </label>
 <input type="text" maxlength="64" name="edit[tel]" id="edit-tel"  size="30" value="<?php echo $tel; ?>" />
 <div class="description">Your phonecall must be right</div>
</div>
<div class="form-item">
 <label for="edit-web">website:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</label>
 <input type="text" maxlength="64" name="edit[web]" id="edit-web"  size="30" value="<?php echo $web; ?>" />
 <div class="description">Your website must be right</div>
</div>
<div class="form-item">
 <label for="edit-birthday">birthday:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </label>
 <input type="text" maxlength="64" name="edit[birthday]" id="edit-birthday"  size="30" value="<?php echo $birthday; ?>" />
 <div class="description">please input your birthday right</div>
</div>
<div class="form-item">
 <label for="edit-inter">hobby:</label>
 <p>
   <textarea  name="edit[inter]" id="edit-inter"  rows="6" cols="45"><?php echo $inter; ?></textarea>
 </p>
</div>
<div class="form-item">
 <label for="edit-intro">selfintroducation:<br>
</label>
 <textarea  name="edit[intro]" id="edit-intro"  rows="6" cols="45" ><?php echo $intro; ?></textarea>
</div>
<?php
if($_GET["id"]!="" && $_SESSION["userid"]==1) {
	echo "<input type='hidden' name='id' value='{$_GET['id']}' />";
}
?>
<input type="submit" name="op" value="updata"  class="form-submit" onclick="return check_form();"  />
<br /><br />
</div></form>
<!-- end content -->
   </td>
  </tr>
 </table>

 </body>
</html>
